<%--
    file: module.jsp
--%>
<%@page import="java.util.List"%>
<%@page 
    contentType="text/html" pageEncoding="UTF-8"
%>

<%
    List modules = null;
    if (null != request.getAttribute("mymodules")) {
        modules = (List)request.getAttribute("mymodules");
    }

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" type="text/css" href="/StudentClientWeb/img/style.css" />
        <title>Module Search System</title>
    </head>

    <body>
        <div id="page">

            <div id="header">
                <h1>Module Search System</h1>
                <h2>Web-based client application, Module Search System for Student</h2>

            </div>
            <div id="bar">
                <div class="link"><a href="module">Module Search</a></div>
                <div class="link"><a href="mymodules">My Modules</a></div>
                <div class="link"><a href="profile">Profile</a></div>
                <div class="link"><a href="logout">Logout</a></div>
            </div>
            
            <div class="contentTitle"><h1>My Modules</h1></div>
            <div class="contentText">

              <table class="csstable" cellspacing="0" cellpadding="0">
              <tr>
                <th scope="col" style="width: 30px">ID</th>
                <th scope="col" style="width: 100px">Module</th>
                <th scope="col" style="width: 100px">Lecture</th>
                <th scope="col" style="width: 200px">Tutorials</th>
              </tr>
              <% if (null != modules) {
                for(Object m:modules){
                    List mod = (List)m;
              %>
                    <tr>
                      <td><p><%=mod.get(0)%></p></td>
                      <td><p><%=mod.get(2)%></p><p><%=mod.get(3)%></p></td>
                      <td><p><%=mod.get(1)%></p><p><%=mod.get(4)%></p><p><%=mod.get(5)%></p></td>
                      <td>
                      <% 
                       List tuts = (List)mod.get(6);
                       if (null !=tuts && !tuts.isEmpty()) {
                        for(Object t:tuts){
                            List tut = (List)t;
                      %>   
                          <p><%=tut.get(1)%></p>
                          <p><%=tut.get(2)%></p>
                          <p><%=tut.get(3)%></p>
                          <p><%=tut.get(4)%></p>
                      <%}}%>
                      </td>
                    </tr>
              <%}}else{%>
                    <tr>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
              <%}%>
            </table>	
            </div>  
        </div>
        <div id="footer"><a href="http://www.culin.net">web development</a> by <a href="http://www.cuilin.com">Cui Lin</a></div>
    </body>
</html>